#include<stdio.h>
#define  N  20
void CaculateYH(int a[][N], int n);
void PrintYH(int a[][N], int n);
main() {  	 	       
    int a[N][N] = {0}, n;//1
    printf("Input  n(n<20):\n");
    scanf("%d", &n);//1
    CaculateYH(a, n);//1
    PrintYH(a, n);   //1
}  	 	       
void CaculateYH(int a[][N], int n) {  	 	       
    int i, j;
    for (i = 0; i < n; i++) //1
    {  	 	       
        a[i][0] = 1;//1
        a[i][i] = 1;//1
    }
    for (i = 2; i < n; i++)//1
    {  	 	       
        for (j = 1; j <= i - 1; j++) //1
        {  	 	       
            a[i][j] = a[i - 1][j - 1] + a[i - 1][j];//1
        }
    }
}  	 	       
void PrintYH(int a[][N], int n) {  	 	       
    int i, j;
    for (i = 0; i < n; i++) //1
    {  	 	       
        for (j = 0; j <= i; j++) //1
        {  	 	       
            printf("%4d", a[i][j]);//1
        }
        printf("\n");//1
    }
}